#include "Triangle3D.h"

Triangle3D::Triangle3D(const Point3DID &i_first, const Point3DID &i_second, const Point3DID &i_third)
  {
  m_points[0] = i_first;
  m_points[1] = i_second;
  m_points[2] = i_third;
	const TVector3 DEFAULT_NORMAL(0, 0, 1);
	m_point_normals[0] = DEFAULT_NORMAL;
	m_point_normals[1] = DEFAULT_NORMAL;
	m_point_normals[2] = DEFAULT_NORMAL;
  }

const TVector3& Triangle3D::GetPoint(unsigned int i_number) const
  {
  const Point3D* point = m_points[i_number].m_object;

  return point->m_data;
  }



void Triangle3D::SetPointsUV(const TVector2 &i_firstUV, const TVector2 &i_secondUV, const TVector2 &i_thirdUV)
  {
  m_uv_coords[0] = i_firstUV;
  m_uv_coords[1] = i_secondUV;
  m_uv_coords[2] = i_thirdUV;
  }

void Triangle3D::SetPointNormals(const TVector3& i_first_normal, const TVector3& i_second_normal, const TVector3& i_third_normal)
	{
	m_point_normals[0] = i_first_normal;
	m_point_normals[1] = i_second_normal;
	m_point_normals[2] = i_third_normal;
	}


const TVector2& Triangle3D::GetPointUV(unsigned int i_number) const
  {
  return m_uv_coords[i_number];
  }

const TVector3& Triangle3D::GetPointNormal(unsigned int i_number) const
	{
	return m_point_normals[i_number];
	}

Point3DID Triangle3D::GetPointId(unsigned int i_number) const
  {
  return m_points[i_number];
  }

// Triangle3DID

Triangle3DID::Triangle3DID(Triangle3D* i_object)
  :m_object(i_object)
  {
  }

Triangle3D& Triangle3DID::GetTriangle()
  {
  return *m_object;
  }



